package org.example.management.controller;

import org.example.management.service.ICreatHtmlService;
import org.example.management.service.IGoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.thymeleaf.TemplateEngine;

// @RestController
@RequestMapping("/type")
@RestController
public class GoodsTypeController {

    @Autowired
    private IGoodsTypeService goodsTypeService;

    @Autowired
    private ICreatHtmlService creatHtmlService;


    @Autowired
    private TemplateEngine templateEngine;

    /**
     * 查询所有分类的目录结构
     * @return
     */
    @GetMapping
    //获取所有商品分类
    public Object getCategoryList() {
        return goodsTypeService.getAllTypeAndChildren();
    }



    @GetMapping("/{id}")
    public Object getTopType(@PathVariable long id){
        return goodsTypeService.findTopGoodsType(id);
    }



}
